<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class mgetsite extends MY_Model {

    var $theme_data = array(
        'layout_main' => 'layout',
        'left' => 'include/leftcp',
    );
    public $mytable = "program";
    public $primaryKey = "PROG_ID";
    public $resCode = "PROGRAM";

    function __construct() {
        parent::__construct();
    }

   function insert_program($arr_insert) {
        $link = $arr_insert['GET_LINK'];
		$this->db->where("GET_LINK",$link);
		$checkLink = $this->db->get("tv_program")->first_row();
		if($checkLink){
			return $checkLink->GET_ID;
		}
        $this->db->insert('tv_program', $arr_insert);
        return $this->db->insert_id();
    }
	
	 function insert_series($arr_insert) {
		$this->db->where("GET_PROG_ID",$arr_insert['GET_PROG_ID']);
		$this->db->where("SER_TITLE",$arr_insert['SER_TITLE']);
		$checkLink = $this->db->get("tv_series")->first_row();
		if($checkLink){
			return $checkLink->GET_ID;
		}
        $this->db->insert('tv_series', $arr_insert);
        return $this->db->insert_id();
    }
	
	function insert_video($arr_insert) {
		$this->db->where("GET_LINK",$arr_insert['GET_LINK']);
		$checkLink = $this->db->get("tv_video")->first_row();
		if($checkLink){
			return $checkLink->GET_ID;
		}
        $this->db->insert('tv_video', $arr_insert);
        return $this->db->insert_id();
    }
	
}

?>